import request from '@/utils/request'
import webrequest from '@/utils/webServerRequest'
const shop_id = localStorage.getItem('shop_id')
export const getShopIdData = (data) => {
  return webrequest({
    url: `api/product/setOffline`,
    method: 'post',
    paramete: {
      shop_id: data.shop_id
    },
    data: {
      product_id: data.product_id
    }
  })
}
import qs from 'qs'
export const batchOffline = (data) => {
  return webrequest({
    url: `product/tproduct/batchOffline`,
    method: 'post',
    paramete: {
      //   shop_id: data.shop_id
    },
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify({
      'product_ids[]': data.product_id
    })
  })
}

export const launchProduct = (data) => {
  return webrequest({
    url: `api/product/launchProduct`,
    method: 'post',
    paramete: {
      shop_id: data.shop_id
    },
    data: {
      product_id: data.product_id
    }
  })
}
export const canOnline = (data) => {
  return webrequest({
    url: `product/tproduct/launchProduct`,
    method: 'post',
    paramete: {},
    headers: {
      'content-type': 'application/json;charset=UTF-8'
    },
    data: data
  })
}

export const getShopUserPhone = (data) => {
  return webrequest({
    url: `api/product/listV2`,
    method: 'post',
    paramete: {
      shop_id: data.shop_id
    },
    data: {
      product_id: data.product_id,
      size: data.size,
      page: data.page
    }
  })
}

export const productShopId = (data) => {
  return webrequest({
    url: `api/product/del`,
    method: 'post',
    paramete: {
      shop_id: data.shop_id
    },
    data: {
      product_id: data.product_id,
      delete_forever: data.delete_forever
    }
  })
}

export const webpagehttp = (data) => {
  return webrequest({
    url: `shop/product_card/channel_product/channel_product_list`,
    method: 'get',
    paramete: {
      shop_id: shop_id
    },
    paramete: data
  })
}
export const index_data = (data) => {
  return webrequest({
    url: `business_api`,
    method: 'head',
    paramete: {},
    paramete: data
  })
}
export const modify_index = (data) => {
  return webrequest({
    url: `modify_index`,
    method: 'post',
    paramete: {
      verifyFp: 'verify_ly8grujk_GafO9F4D_ga1o_48JO_BzkP_JCafpl5M4t1E',
      fp: 'verify_ly8grujk_GafO9F4D_ga1o_48JO_BzkP_JCafpl5M4t1E',
      msToken:
        'TjOowKEjuTRoUQfQaQbnyqqqipWM8-E9l1bL5egtN0tk_rSU83M7xAiH3AqVQkP31R1NX6DW0cBf91_gmgL60HZaJKMoWAvY96xhfxPy68-1VyvBKtM8VQ%3D%3D',
      a_bogus:
        'xfRZBmzgdDdPgVgD569LfY3qIgc5Y0E20G3FMDZuCYr%2FM639HMTA9exE1xGvtUSjNs%2FDIejjy4hbYNnhrQCJ01wfHuiE%2F2CZmyT0cMlM524j-piruyUgrUwi-hsASeHmsv1IEQfkqwArFuRDAICcmh26PLZCcHhMHjDISpcG2r6%3D'
    },
    data: data
  })
}
export const tproduct = (data) => {
  return webrequest({
    // url: `api/product/tproduct/list`,
    url: `product/tproduct/list`,
    method: 'get',
    paramete: {
      shop_id: shop_id
    },
    paramete: data
  })
}
export const previewDetail = (data) => {
  return webrequest({
    url: `product/tproduct/previewDetail`,
    method: 'get',
    paramete: {
      shop_id: shop_id
    },
    paramete: data
  })
}

export const skulist = (data) => {
  return webrequest({
    url: `api/sku/list`,
    method: 'get',
    paramete: {
      shop_id: shop_id
    },
    paramete: data
  })
}
export const product_detail = (data) => {
  return webrequest({
    url: `core_data/index_data`,
    method: 'get',
    paramete: {
      // shop_id: shop_id
    },
    paramete: data
  })
}
export const product_list = (data) => {
  return webrequest({
    url: `product_list`,
    method: 'get',
    paramete: {
      // shop_id: shop_id
    },
    paramete: data
  })
}
export const index = (data) => {
  return webrequest({
    url: `common/index/index`,
    method: 'get',
    paramete: {
      appid: 1,
      _: new Date().getTime()
    }
  })
}
export const shopLogin = (data) => {
  return webrequest({
    url: `api/user/shopLogin`,
    method: 'get',
    paramete: {
      // shop_id: shop_id,
      appid: 1,
      _: new Date().getTime(),
      shop_phone: localStorage.getItem('shop_phone'),
      _bid: 'ffa_goods',
      _: '1714730498196'
    },
    paramete: data
  })
}
